home *** CD-ROM | disk | FTP | other *** search
/ Hráč 2004 August / Hrac_72_2004-08_dvd.iso / dema / Rapid Gun / rg_setup.exe / common / fog.fxh < prev    next >
Text File  |  2004-04-21  |  738b  |  21 lines

  1. // LF2 Engine
  2. // (C) 2002-3 7FX
  3. //---------------------------------------------------------------------------
  4. // Header file with fog functions
  5. //---------------------------------------------------------------------------
  6. // Fog - input: view vertex position - output: fog factor 
  7. // Linear fog formula
  8. float LinearFog(const float3 viewPos)
  9. {
  10.     // f = (end - d)/(end - start)
  11.     return (500.f - viewPos.z)/(500.f - 0.f);
  12. }
  13. //---------------------------------------------------------------------------
  14. // Exponential fog formula
  15. float ExpFog(const float3 viewPos)
  16. {
  17.     // f = 1.f/(e^(d * density))
  18.     return 1.0f/(pow(SC_E, viewPos.z * 0.005f));
  19. }
  20. //---------------------------------------------------------------------------
  21.